//配置不同访问的api地址

import myAxios from "@/utils/request";
import mockAxios from "@/utils/requertMock";


export const NevtypeAxios = () => {
   return myAxios.get("/product/getBaseCategoryList")
}

export const SearchAxios = (a) => {
   return myAxios.post("/list", a)
}
/* SearchAxios({}) */

export const DetailAxios = (skuId) => {
   return myAxios.get("/item/" + skuId)
}

//添加购物车
export const AddGoodsCart = (skuID, skuNum) => {
   return myAxios.post("/cart/addToCart/" + skuID + "/" + skuNum)
}

//获取购物车数据
export const GetShopCart = () => {
   return myAxios.get("/cart/cartList")
}

//修改单个商品选中状态
export const SetGoodChecke = (skuID, isChecked) => {
   return myAxios.get(`/cart/checkCart/${skuID}/${isChecked}`)
}

//获取是否全选
export const GetAllChecke = (isChecked, skuIdList) => {
   return myAxios.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
}


//删除单个商品
export const DeleteOneGood = (skuId) => {
   return myAxios.delete(`/cart/deleteCart/${skuId}`)
}

//删除所有选中商品
export const DeleteAll = (skuIdList) => {
   return myAxios.delete(`/cart/batchDeleteCart`, {
      data: skuIdList
   })
}

//获取注册验证码
export const GetCode=(phone)=>{
   return myAxios.get(`/user/passport/sendCode/${phone}`)
}

//注册
export const GetUserRegister=(userInfo)=>{
   return myAxios.post(`/user/passport/register`, userInfo)
}

//登录
export const GetUserLogin=(userInfo)=>{
   return myAxios.post(`/user/passport/login`, userInfo)
}

//根据token获取用户信息，token判断是否登录
export const GetUserInfo=()=>{
   return myAxios.get(`/user/passport/auth/getUserInfo`)
}

//退出登录，使当前token过期清空
export const outlogin=()=>{
   return myAxios.get(`/user/passport/logout`)
}

//获取交易商品信息
export const Goodsinfo=()=>{
   return myAxios.get(`/order/auth/trade`)
}

//发送订单 获取单号
export const indent=(tradeNo,orderInfo)=>{
   return myAxios.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, orderInfo)
}

//发送订单号 获取订单详情
export const indentinfo=(indentNum)=>{
   return myAxios.get(`/payment/weixin/createNative/${indentNum}`)
}

//查询支付状态
export const PaymentStatus=(indentNum)=>{
   return myAxios.get(`/payment/weixin/queryPayStatus/${indentNum}`)
}

//请求所有订单数据
export const indentData=(page,limit)=>{
   return myAxios.get(`/order/auth/${page}/${limit}`)
}


//请求收获地址信息
/* export const TradeAddress=()=>{
   return myAxios.get(`/user/userAddress/auth/findUserAddressList`)
} */
export const TradeAddress=()=>{
   return mockAxios.get(`/address`)
}

export const bannerAxios = () => {
   return mockAxios.get("/banner")
}


export const floorAxios = () => {
   return mockAxios.get("/floor")
}